change_multifile_images/**
 * 上传附件（图片、文件、视频）
 * @param module      附件类型 0-图片  1-文件  2-视频
 * @param name        弹窗标题
 * @param num         附件数量
 * @param ext         允许的格式  jpg|bmp|png , zip|rar  , flv ....
 * @param size        大小单位MB
 * @param textareaid  返回内容位置
 * @param funcName    调用数据的处理函数
 */
function flashupload(module,name,num,ext,size,textareaid,funcName) {
	var setting = 'module='+module+'&num='+num+'&ext='+ext+'&size='+size ;
	var uploadid = 'piclist' ;
    art.dialog.open("/api.php/attach/plus?"+setting,
            {
			    title: name,
			    id:uploadid,
				width: 520,
				height: 420,
				lock: true,
				fixed:true,
			    ok: function(topWin){
 			    funcName.apply(this, [uploadid, textareaid]);
               },
                cancel: true
			 }
		 );

}

//裁切图片 fname是对应页面的id标记
function imageCut(fname)
{
	if($Nav()=='IE'){ var posLeft = window.event.clientX-100; var posTop = window.event.clientY; }
	else{ var posLeft = 1; var posTop = 100; }
	file = document.getElementById(fname).value;
	if(file == '') {
		alert('请先选择网站内已上传的图片');
		return false;
	}
	window.open("/api.php/attach/crop?file="+file+"&tag="+fname, "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left="+posLeft+", top="+posTop);
}

//裁切图片 fname是对应页面的id标记
function imageCrop(fname,cid,size)
{
	if($Nav()=='IE'){ var posLeft = window.event.clientX-100; var posTop = window.event.clientY; }
	else{ var posLeft = 1; var posTop = 100; }
	file = document.getElementById(fname).value;
	if(file == '') {
		alert('请先选择网站内已上传的图片');
		return false;
	}
	window.open("/api.php/attach/cmpcrop?file="+file+"&tag="+fname+"&cid="+cid+"&size="+size, "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left="+posLeft+", top="+posTop);
}

function $Nav()
{
	if(window.navigator.userAgent.indexOf("MSIE")>=1) return 'IE';
	else if(window.navigator.userAgent.indexOf("Firefox")>=1) return 'FF';
	else return "OT";
}

function croppic(pic,textareaid) {
	var uploadid = 'croppic' ;
	var funcName = '' ;
    art.dialog.open("/api.php/attach/crop?pic="+pic,
            {
			    title: '图片裁切',
			    id:uploadid,
			    lock: true,
			    fixed:true,
			    ok: function(topWin){
			    	var d = this.iframe.contentWindow;

			    	var in_content = d.$("#pic").val();
			    	if (in_content == '') return false;
			    	if (!IsImg(in_content)) {
			    		alert('选择的类型必须为图片类型');
			    		return false;
			    	}
			    	if ($('#' + textareaid + '_preview').attr('src')) {
			    		$('#' + textareaid + '_preview').attr('src', in_content);
			    	}
			    	$('#' + textareaid).val(in_content);
               },
                cancel: true
			 }
		 );

}


function remove_div(k){
	$('#'+k).remove();
}


function moveup_div(k){
	var dom=$('#'+k).prev();
	if(!dom.html())return;
	dom.before($('#'+k));
}


function movetop_div(k){
    var dom=$('#'+k).prev();
	if(!dom.html())return;
	$("#files li").first().before($('#'+k));
}


function top_div(k){
	var dom=$('#'+k).find("img");
	$("#thumb_preview").attr("src",dom.attr("src"));
	$("#thumb").val(dom.attr("src"));
}


function change_multifile_images(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='multifile" + ids + "'><div class='goodimg'><img src='"+ n +"' id='multi"+ids+"_preview'><input type='hidden'  id='multi"+ids+"' name='" + returnid + "_url[]' value='" + n + "'><p><a href=\"javascript:top_div('multifile" + ids + "')\">封面图</a> <a href=\"javascript:remove_div('multifile" + ids + "')\">移除</a> <a href=\"javascript:moveup_div('multifile" + ids + "')\">上移</a> <a href=\"javascript:movetop_div('multifile" + ids + "')\">置顶</a> <a href=\"javascript:imageCut('multi" + ids + "')\">裁剪</a></p></div></li>";
	});
	//$('#' + returnid).html(str);
	$('#' + returnid).append(str);
}

function thumb_images_sku(uploadid,returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	if (!IsImg(in_content)) {
		alert('选择的类型必须为图片类型');
		return false;
	}

	$('#' + returnid).attr('src',in_content).attr('data-bimg',in_content);
}

function change_multifile_images_(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='multifile" + ids + "'><div class='goodimg'><img src='"+ n +"' id='multi"+ids+"_preview'><input type='hidden'  id='multi"+ids+"' name='" + returnid + "_url[]' value='" + n + "'><textarea placeholder='请填写备注信息' name='" + returnid + "_alt[]' class='input-text'>" + filename + "</textarea><p> <a href=\"javascript:remove_div('multifile" + ids + "')\">移除</a> <a href=\"javascript:moveup_div('multifile" + ids + "')\">上移</a> <a href=\"javascript:movetop_div('multifile" + ids + "')\">置顶</a> <a href=\"javascript:imageCut('multi" + ids + "')\">裁剪</a></p></div></li>";
	});
	//$('#' + returnid).html(str);
	$('#' + returnid).append(str);
}

function change_multifile_images_noword(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='multifile" + ids + "'><div class='goodimg'><img src='"+ n +"' id='multi"+ids+"_preview'><input type='hidden'  id='multi"+ids+"' name='" + returnid + "_url[]' value='" + n + "'><p> <a href=\"javascript:remove_div('multifile" + ids + "')\">移除</a> <a href=\"javascript:moveup_div('multifile" + ids + "')\">上移</a> <a href=\"javascript:movetop_div('multifile" + ids + "')\">置顶</a> <a href=\"javascript:imageCut('multi" + ids + "')\">裁剪</a></p></div></li>";
	});
	//$('#' + returnid).html(str);
	$('#' + returnid).append(str);
}

function change_images(uploadid,returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = $('#' + returnid).html();
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='image" + ids + "'><input type='text' name='" + returnid + "_url[]' value='" + n + "' style='width:310px;' ondblclick='image_priview(this.value);' class='input-text'> <input type='text' name='" + returnid + "_alt[]' value='" + filename + "' style='width:160px;' class='input-text' onfocus=\"if(this.value == this.defaultValue) this.value = ''\" > <a href=\"javascript:remove_div('image" + ids + "')\">移除</a> </li>";
	});

	//$('#' + returnid).html(str);
	$('#' + returnid).append(str);
}


function setVideo_value(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='multifile" + ids + "'><input type='text' name='"+returnid+"' value='" + n + "' size='100'  class='input-text inpMain J_preview' data-bimg='" + filename + "'> </li>";
	});
	$('#' + returnid).html(str);
}


function change_multifile_update(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='multifile" + ids + "'><input type='text' name='" + returnid + "_url[]' value='" + n + "' style='width:160px;' class='input-text J_preview' data-bimg='" + filename + "'> <input type='text' name='" + returnid + "_alt[]' value='" + filename + "' style='width:410px;' class='input-text'> <a href=\"javascript:remove_div('multifile" + ids + "')\">移除</a> <a href=\"javascript:moveup_div('multifile" + ids + "')\">上移</a> <a href=\"javascript:movetop_div('multifile" + ids + "')\">置顶</a> </li>";
	});
	//$('#' + returnid).html(str);
	$('#' + returnid).append(str);
}


function change_input_update(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str = n;
	});
	$('#' + returnid).val(str);
}



function change_multifile(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='multifile" + ids + "'><input type='text' name='" + returnid + "_url[]' value='" + n + "' style='width:310px;' class='input-text'> <input type='text' name='" + returnid + "_alt[]' value='" + filename + "' style='width:160px;' class='input-text' onfocus=\"if(this.value == this.defaultValue) this.value = ''\" onblur=\"if(this.value.replace(' ','') == '') this.value = this.defaultValue;\"> <a href=\"javascript:remove_div('multifile" + ids + "')\">移除</a> </li>";
	});
	$('#' + returnid).append(str);
}


function thumb_images(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	if (in_content == '') return false;
	if (!IsImg(in_content)) {
		alert('选择的类型必须为图片类型');
		return false;
	}
	if ($('#' + returnid + '_preview').attr('src')) {
		$('#' + returnid + '_preview').attr('src', in_content);
	}
	$('#' + returnid).val(in_content);
}

function thumb_onefile(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	if (in_content == '') return false;
	// if (!IsImg(in_content)) {
	// 	alert('选择的类型错误');
	// 	return false;
	// }
	if ($('#' + returnid + '_preview').attr('src')) {
		$('#' + returnid + '_preview').attr('src', '/Public/Admin/img/ext/rar.png');
	}
	$('#' + returnid).val(in_content);
	//显示图图
	$('#' + returnid + '_preview').css('display','inline-block');
	$('.thumbfile_txt').css('display','inline-block');

}


function images_url(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	if (in_content == '') return false;
	if (!IsImg(in_content)) {
		alert('选择的类型必须为图片类型');
		return false;
	}

	$('#' + returnid).val(in_content);
	$('#' + returnid).attr('data-bimg',in_content);
}


function submit_images(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_content = in_content.split('|');
	IsImg(in_content[0]) ? $('#' + returnid).attr("value", in_content[0]) : alert('选择的类型必须为图片类型');
}


function submit_attach(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_content = in_content.split('|');
	$('#' + returnid).attr("value", in_content[0]);
}

function submit_files(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_content = in_content.split('|');
	var new_filepath = in_content[0].replace(uploadurl, '/');
	$('#' + returnid).attr("value", new_filepath);
}


function IsImg(url) {
	var sTemp;
	var b = false;
	var opt = "jpg|gif|png|bmp|jpeg|ico";
	var s = opt.toUpperCase().split("|");
	for (var i = 0; i < s.length; i++) {
		sTemp = url.substr(url.length - s[i].length - 1);
		sTemp = sTemp.toUpperCase();
		s[i] = "." + s[i];
		if (s[i] == sTemp) {
			b = true;
			break;
		}
	}
	return b;
}

function IsSwf(url) {
	var sTemp;
	var b = false;
	var opt = "swf";
	var s = opt.toUpperCase().split("|");
	for (var i = 0; i < s.length; i++) {
		sTemp = url.substr(url.length - s[i].length - 1);
		sTemp = sTemp.toUpperCase();
		s[i] = "." + s[i];
		if (s[i] == sTemp) {
			b = true;
			break;
		}
	}
	return b;
}

function image_priview(img) {
	art.dialog({title:'图片查看',fixed:true, content:'<img src="'+img+'" />',id:'image_priview'});
}

function removeImg(textareaid){
	$('#' + textareaid + '_preview').attr('src', '/static/common/attach/images/upload-pic.png');
	$('#' + textareaid).val('');
}

function removeImg_file(textareaid){
	$('#' + textareaid + '_preview').css('display','none');
	$('.thumbfile_txt').css('display','none');
	$('#' + textareaid).val('');
}

function get_icon(funcName,icon_text,icon_img,type){
	art.dialog.open('/api.php/attach/icon?type='+type,{
		title:'选择图标',
		width:800,
		height:400,
		lock: true,
		fixed:true,
		id:'icon_page',
		ok:function(){
			funcName(icon_text,icon_img);
		},
		cancel:true
	});
}

function set_icon(icon_text,icon_img){
	var d = art.dialog({
		id: 'icon_page'
	}).iframe.contentWindow;

	var select_icon = d.$("#icon_list img.select");
	var path = select_icon.attr('src');
	$("#" + icon_text).val(path);
	$("#" + icon_img).attr('src',path);
}

function cmpupload(module,name,num,ext,size,textareaid,funcName,cid) {
	var setting = 'module='+module+'&num='+num+'&ext='+ext+'&size='+size+'&cid='+cid ;
	var uploadid = 'piclist' ;
    art.dialog.open("/api.php/attach/plus?"+setting,
            {
			    title: name,
			    id:uploadid,
				width: 520,
				height: 420,
				lock: true,
				fixed:true,
			    ok: function(topWin){
 			    funcName.apply(this, [uploadid, textareaid]);
               },
                cancel: true
			 }
		 );

}

function change_multifile_images_cmp(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='multifile" + ids + "'><div class='goodimg'><img src='"+ n +"' id='multi"+ids+"_preview'><input type='hidden'  id='multi"+ids+"' name='" + returnid + "_url[]' value='" + n + "'><textarea placeholder='请填写备注信息' name='" + returnid + "_alt[]' class='input-text'>" + filename + "</textarea><p><a href=\"javascript:top_div('multifile" + ids + "')\">封面图</a> <a href=\"javascript:remove_div('multifile" + ids + "')\">移除</a> <a href=\"javascript:moveup_div('multifile" + ids + "')\">上移</a> <a href=\"javascript:movetop_div('multifile" + ids + "')\">置顶</a> </p></div></li>";
	});
	$('#' + returnid).append(str);
}

function change_multifile_images_welcome(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='multifile" + ids + "'><div class='goodimg'><img src='"+ n +"' id='multi"+ids+"_preview'><input type='hidden'  id='multi"+ids+"' name='" + returnid + "_url[]' value='" + n + "'><textarea placeholder='请填写链接地址' name='" + returnid + "_alt[]' class='input-text'></textarea><p><a href=\"javascript:moveup_div('multifile" + ids + "')\">上移</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\"javascript:remove_div('multifile" + ids + "')\">移除</a></p></div></li>";
	});
	$('#' + returnid).append(str);
}


function createNew_cols(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	if (in_content == '') return false;
	if (!IsImg(in_content)) {
		alert('选择的类型必须为图片类型');
		return false;
	}

	var ids = parseInt(Math.random() * 10000);
	var t=document.getElementById(returnid)
	var len = $("#"+returnid+" tr").length+1;
	var tr=document.createElement("tr");
	tr.id='url'+ids;
	var html="<td><b>"+len+"</b></td>";
		html+="<td>";
		html+="<img src='"+in_content+"' id='img"+ids+"_preview' style=\"max-width:200px;\"><input id='img"+ids+"' name=\"gpic[]\" type=\"hidden\" value='"+in_content+"'><input name=\"gtitle[]\" type=\"hidden\" value=''>";
		html+="</td>";
		html+="<td><textarea name=\"gurl[]\" cols=\"50\" rows=\"5\"></textarea><input name=\"gurl[]\" type=\"hidden\" style=\"width:300px\" value=\"\"></td>";
		html+="<td><a class=\"remove\" onclick=\"editimg('img"+ids+"');\" href=\"javascript:;\">更换图片</a> <a class=\"remove\" onclick=\"moveuptr('url"+ids+"');\" href=\"javascript:;\">上移</a> <a class=\"remove\" onclick=\"movetoptr('url"+ids+"');\" href=\"javascript:;\">置顶</a> <a class=\"remove\" onclick=\"delrows(this);\" href=\"javascript:;\">删除</a></td>";
		tr.innerHTML=html;
		t.appendChild(tr);
}

function createNew_cols_title(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	if (in_content == '') return false;
	if (!IsImg(in_content)) {
		alert('选择的类型必须为图片类型');
		return false;
	}

	var ids = parseInt(Math.random() * 10000);
	var t=document.getElementById(returnid)
	var len = $("#"+returnid+" tr").length+1;
	var tr=document.createElement("tr");
	tr.id='url'+ids;
	var html="<td><b>"+len+"</b></td>";
		html+="<td>";
		html+="<img src='"+in_content+"' id='img"+ids+"_preview' style=\"max-width:200px;\"><input id='img"+ids+"' name=\"gpic[]\" type=\"hidden\" value='"+in_content+"'>";
		html+="</td>";
		html+="<td><input name=\"gtitle[]\" style=\"width:200px;margin-bottom:5px;\" value=\"\"><textarea name=\"gurl[]\" cols=\"50\" rows=\"5\"></textarea><input name=\"gurl[]\" type=\"hidden\" style=\"width:300px\" value=\"\"></td>";
		html+="<td><a class=\"remove\" onclick=\"editimg('img"+ids+"');\" href=\"javascript:;\">更换图片</a> <a class=\"remove\" onclick=\"moveuptr('url"+ids+"');\" href=\"javascript:;\">上移</a> <a class=\"remove\" onclick=\"movetoptr('url"+ids+"');\" href=\"javascript:;\">置顶</a> <a class=\"remove\" onclick=\"delrows(this);\" href=\"javascript:;\">删除</a></td>";
		tr.innerHTML=html;
		t.appendChild(tr);
}

function createNew_cols_multi_title(uploadid, returnid) {
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	if (in_content == '') return false;
	if (!IsImg(in_content)) {
		alert('选择的类型必须为图片类型');
		return false;
	}

	var ids = parseInt(Math.random() * 10000);
	var t=document.getElementById(returnid)
	var len = $("#"+returnid+" tr").length+1;
	var tr=document.createElement("tr");
	tr.id='url'+ids;
	var html="<td><b>"+len+"</b></td>";
		html+="<td>";
		html+="<img src='"+in_content+"' id='img"+ids+"_preview' style=\"max-width:200px;\"><input id='img"+ids+"' name=\"gpic[]\" type=\"hidden\" value='"+in_content+"'>";
		html+="</td>";
		html+="<td><input name=\"gtitle[]\" style=\"width:200px;margin-bottom:5px;\" value=\"\"><input name=\"gstitle[]\" style=\"width:200px;margin-bottom:5px;\" value=\"\"><textarea name=\"gurl[]\" cols=\"50\" rows=\"5\"></textarea><input name=\"gurl[]\" type=\"hidden\" style=\"width:300px\" value=\"\"></td>";
		html+="<td><a class=\"remove\" onclick=\"editimg('img"+ids+"');\" href=\"javascript:;\">更换图片</a> <a class=\"remove\" onclick=\"moveuptr('url"+ids+"');\" href=\"javascript:;\">上移</a> <a class=\"remove\" onclick=\"movetoptr('url"+ids+"');\" href=\"javascript:;\">置顶</a> <a class=\"remove\" onclick=\"delrows(this);\" href=\"javascript:;\">删除</a></td>";
		tr.innerHTML=html;
		t.appendChild(tr);
}


function agree_images_cmp(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='multifile" + ids + "'><div class='goodimg'><img src='"+ n +"' id='multi"+ids+"_preview'><input type='hidden'  id='multi"+ids+"' name='" + returnid + "_url[]' value='" + n + "'><p><a href=\"javascript:remove_div('multifile" + ids + "')\">移除</a> <a href=\"javascript:moveup_div('multifile" + ids + "')\">上移</a> <a href=\"javascript:movetop_div('multifile" + ids + "')\">置顶</a> </p></div></li>";
	});
	$('#'+returnid).append(str);
}

function movetopalbum_div(k){
    var dom=$('#'+k).prev();
	if(!dom.html())return;
	$("#wapfiles li").first().before($('#'+k));
}

function change_multifile_images_album(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='wapic" + ids + "'><div class='goodimg'><img src='"+ n +"'><input type='hidden' name='wfile_url[]' value='" + n + "'><textarea placeholder='请填写链接地址' name='wfile_alt[]' class='input-text'></textarea><p><a href=\"javascript:remove_div('wapic" + ids + "')\">移除</a> <a href=\"javascript:moveup_div('wapic" + ids + "')\">上移</a> <a href=\"javascript:movetopalbum_div('wapic" + ids + "')\">置顶</a> </p></div></li>";
	});
	$('#' + returnid).append(str);
}


function change_multifile_images_pcalbum(uploadid, returnid){
	var d = art.dialog({
		id: uploadid
	}).iframe.contentWindow;

	var in_content = d.$("#att-status").html().substring(1);
	var in_filename = d.$("#att-name").html().substring(1);
	var str = '';
	var contents = in_content.split('|');
	var filenames = in_filename.split('|');
	$('#' + returnid + '_tips').css('display', 'none');
	if (contents == '') return true;
	$.each(contents, function(i, n) {
		var ids = parseInt(Math.random() * 10000 + 10 * i);
		var filename = filenames[i].substr(0, filenames[i].indexOf('.'));
		str += "<li id='pcpic" + ids + "'><div class='goodimg'><img src='"+ n +"'><input type='hidden' name='pcpic_url[]' value='" + n + "'><textarea placeholder='请填写链接地址' name='pcpic_alt[]' class='input-text'></textarea><p><a href=\"javascript:remove_div('pcpic" + ids + "')\">移除</a> <a href=\"javascript:moveup_div('pcpic" + ids + "')\">上移</a> <a href=\"javascript:movetop_div('pcpic" + ids + "')\">置顶</a> </p></div></li>";
	});
	$('#' + returnid).append(str);
}
